<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head lang="en">
    <meta charset="UTF-8">
    <title>用户主页面</title>
    <base th:href="@{http://localhost:9090/}"/>
    <script type="text/javascript" th:src="@{/js/jquery-3.2.1.min.js}"></script>
    <!--<script th:src="@{/js/index.js}"></script>-->
    <link th:href="@{/css/user/userMain.css}" rel="stylesheet">

    <script type="text/javascript">
        $(function (){
            $(".departments").hover(function (){
                $.ajax({
                    url: "/getDepartment",
                    type: "GET",
                    dataType: "json",
                    success: function (depList){
                        show(depList);
                    },
                    error: function (depList){
                        alert("科室查询失败！");
                    }
                })
            });
        })
        function show(depList){
            var str = "";
            for (var i = 0; i < depList.length; i++) {
                str += '<div style="width: 100px ; height: auto">'
                    + '<a href="/dmy/touserbooking?departmentName=#{departmentName}">' + depList[i].departmentName + '</a>'
            }
            $(".departments").append(str)
        }
        /*$(function (){
            var num = 1;
            //定时轮转
            timer = setInterval(function (){
                $("#right").click();
            },2000);
            //点击左侧
            $("#left").click(function (){
                num--;
                if (num < 1){
                    num = 2;
                }
                $("img").attr("src","@{/img/user/医院图"+num+".jpg}")
                // $("span").eq(num-1).css("background","green");
                // $("span").eq(num==2?0:num).css("background","");
            })
            $("#right").click(function (){
                num++;
                if (num>2){
                    num = 1;
                }
                $("img").attr("src","@{/img/user/医院图"+num+".jpg}")
                // $("span").eq(num-1).css("background","green");
                // $("span").eq(num-2).css("background","");
            })


        })*/

    </script>
</head>
<body>
    <div id="all">
        <div id="head">
            <!-- 系统logo -->
            <span>
				<button >个人信息修改</button>
				<button >退 出</button>
			</span>
        </div>
        <div id="fun">
            <ul id="head_ul">
                <li>
                    <a class="departments">专家介绍</a>
                </li>
                <li>
                    <a class="departments" th:href="@{/dmy/touserbooking}">预约挂号</a>
                </li>
                <li>
                    <a>诊断查询</a>
                </li>
                <li>
                    <a>缴费服务</a>
                </li>
                <li>
                    <a>购买药品</a>
                </li>
                <li>
                    <a>病友社区</a>
                </li>
            </ul>
        </div>
        <div id="body">
            <div id="image">
                <img th:src="@{/img/user/医院图1.jpg}"/>
                <button id="left"><</button>
                <button id="right">></button>
                <!--<div id="image_last">
                    <span id="1"></span>
                    <span id="2"></span>
                </div>-->
            </div>
        </div>

    </div>
</body>
</html>